<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<link rel="stylesheet" type="text/css" href="css/common.css" />
		<link rel="stylesheet" type="text/css" href="css/global.css" />
		<link rel="stylesheet" type="text/css" href="css/muibar.css" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />

	</head>
	<body>

		<div class="mainbody">
			<div class="login w894">
				<div class="login_bg fl"><img
						src="http://43.243.128.175//theme/jomoo/zh_cn/shop/images/pic/login_left_bg.jpg" width="490"
						height="490" /></div>
				<div class="login_box fr">
					<!--登录内容区 start-->
					<h2>账号登录</h2>
					<form name="" action="#" method="post" id="regform">
						<ul>
							<li><input type="text" placeholder="账号/手机" class="input w310" name="login_tel"
									id="login_tel" value="">
								<div id="login_tel_tips" class="Validform_checktip"></div>
							</li>
							<li><input name="" id="login_password" type="password" placeholder="密码"
									class="input w310 password" value="">
								<div id="login_pw_tips" class="Validform_checktip"></div>
							</li>
							<li>
								<input name="" id="login_yan" type="text" placeholder="验证码" class="input w185">
								<a href="javascript:;" onclick="javascript:changeImg('greph1', 'login');" class="code">
									<img id="greph1" src="http://shop.erke.com/?app_act=secret/reg_create_verify_graph" width="125"
										height="38"></a>
								<div id="login_yan_tips" class="Validform_checktip"></div>
							</li>
						</ul>
						<div class="btn-box">
							<div class="clearfix">
								<span class="fl"><label><input name="autologin" type="checkbox"
											class="checkbox">记住密码</label></span>
								<a class="fr" href="http://shop.erke.com/?app_act=member/forget"
									style="color: #636363">忘记密码？</a>
							</div>
							<div class="col clearfix">
								<a name="" class="submit" type="button" value="登 录" onclick="login('');">登录</a>
								<a class="regist" style="text-align:center;"
									href="reg.html">免费注册</a>
							</div>
						</div>
					</form>
					<!--end 登录内容区-->

					<!--end 注册内容区-->
				</div>
				<div class="cb"></div>
			</div>
		</div>
	</body>
</html>
<script src="jQuery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	//登录
	function login(jumpurl) {
		var login_tel = $.trim($('#login_tel').val());
		var login_password = $.trim($('#login_password').val());
		var login_yan = $.trim($('#login_yan').val());
		var is_auto = $('input[name=autologin]').is(':checked');

		if (login_tel == '') {
			$('#login_tel_tips').addClass('Validform_wrong');
			$('#login_tel_tips').html('请输入手机号');
			return false;
		} else if (!(/^[0-9]{11}$/.test(login_tel))) {
			$('#login_tel_tips').addClass('Validform_wrong');
			$("#login_tel_tips").html("手机号输入有误");
			return false;
		} else {
			$('#login_tel_tips').removeClass('Validform_wrong');
			$('#login_tel_tips').html('');
		}

		if (login_password == '') {
			$('#login_pw_tips').addClass('Validform_wrong');
			$('#login_pw_tips').html('请输入密码');
			return false;
		} else {
			$('#login_pw_tips').html('');
			$('#login_pw_tips').removeClass('Validform_wrong');
		}

		if (login_yan == '') {
			$('#login_yan_tips').addClass('Validform_wrong');
			$('#login_yan_tips').html('请输入验证码');
			return false;
		} else {
			$('#login_yan_tips').html('');
			$('#login_yan_tips').removeClass('Validform_wrong');
		}

		var parameter = new Object();
		parameter['username'] = login_tel;
		parameter['password'] = login_password;
		parameter['login_yan'] = login_yan;
		parameter['is_auto'] = is_auto;

		var url = site_url + "member/login";
		var params = parameter;
		Ajax.call(url, params,
			function(s) {
				if (s.status == 1) {
					if (jumpurl == "") {
						location.href = "http://shop.erke.com/?app_act=my/account";
					} else {
						location.href = jumpurl;
					}
				} else {
					switch (s.status) {
						case -1:
							$('#login_tel_tips').addClass('Validform_wrong');
							$('#login_tel_tips').html(s.message);
							break;
						case -2:
							$('#login_pw_tips').addClass('Validform_wrong');
							$('#login_pw_tips').html(s.message);
							break;
						case -3:
							$('#login_yan_tips').addClass('Validform_wrong');
							$('#login_yan_tips').html(s.message);
							break;
					}
				}
			}, 'POST', 'json');
	}

	function changeImg(id, type) {
		$("#" + id).attr("src", "?app_act=secret/" + type + "_create_verify_graph&t=" + Math.random());
	}

</script>
